package com.zhiyou.app.pojo.enums;


import java.util.Arrays;

/**
 * @Description 提现状态
 * @Author : bind
 * @Date : 2022-06-14 14:41
 */
public enum RefundStatusEnum {
    CREATE("CREATE", "创建"),
    PROCESSING("PROCESSING", "退款中"),
    ABNORMAL("ABNORMAL", "退款失败"),
    CLOSE("CLOSE", "退款关闭"),
    SUCCESS("SUCCESS", "退款完成"),
    ;

    public String code;
    public String name;

    RefundStatusEnum(String code, String name) {
        this.code = code;
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static boolean contains(String s) {
        return Arrays.stream(RefundStatusEnum.values()).map(RefundStatusEnum::toString).anyMatch(s::equals);
    }

    @Override
    public String toString() {
        return String.valueOf(this.code);
    }

    public static RefundStatusEnum parse(String code) {
        return Arrays.stream(RefundStatusEnum.values()).filter(s -> s.code.equals(code)).findFirst().orElse(null);
    }
}
